use actix_web::{Responder, HttpResponse, HttpRequest, Error};
use futures::future::{ready, Ready};
use serde::{Deserialize, Serialize};
use crate::pojo::room::Room;

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct DailyRoomType{
    pub day:Option<String>,
    pub room_list: Option<Vec<Room>>,
}

impl Responder for DailyRoomType {
    type Error = Error;
    type Future = Ready<Result<HttpResponse, Error>>;

    fn respond_to(self, _req: &HttpRequest) -> Self::Future {
        let body = serde_json::to_string(&self).unwrap();

        // Create response and set content type
        ready(Ok(HttpResponse::Ok()
            .content_type("application/json")
            .body(body)))
    }
}